<%@ page language="java"  pageEncoding="utf-8"%>
<%@ page import="com.ejoysoft.wlanyz.business.Ac,java.util.ArrayList,com.ejoysoft.wlanyz.business.Ap,com.ejoysoft.common.Format,com.ejoysoft.common.exception.IdObjectException,java.util.ArrayList,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="java.util.Vector"%>

<%@ include file="../include/jsp/head.jsp"%>
<%try{
	String device_Id = ParamUtil.getString(request,"device_Id","");
	 String strMac_Addr=ParamUtil.getString(request,"strMac_Addr","");
	String classTwoAc1 = ParamUtil.getString(request, "classTwoAc", "");
	if(device_Id.equals(""))
    	throw new IdObjectException("请求处理的信息id为空！或者已经不存在");
    String where="where device_Id='"+device_Id+"'";
    Ap obj2=new Ap(globa,false);
    Ap obj0=obj2.show(where);
    Ac objAc = new Ac(globa);
    ArrayList<String> strACTwo = objAc.getAllclassTwoAcByName(obj0.getStrClassOneHP());
    if(obj0==null){
        globa.closeCon();
        throw new IdObjectException("请求处理的信息id='"+device_Id+"'对象为空！","请检查该信息的相关信息");
    }
%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String classOneAc = ParamUtil.getString(request,"strClassOneHP","").trim();//获取一级热点;
String classTwoAc = ParamUtil.getString(request,"strHotpotName","").trim();//获取二级热点;
//System.out.println("3333333333333"+classOneAc+classOneAc);
Ac obj1=new Ac(globa);
ArrayList<Object[]> classOneList = obj1.getAllclassoneByName("");

%> 

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script src="../scripts/jsframework.js"></script>
<script language="JavaScript" src="../js/jquery-1.4.1.min.js"></script>
<script src="../scripts/jquery-1.4.1.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
body {
	background-color: #f2f8ff;
}
.sel1{ width:160px;}
.STYLE1 {color: #FF0000}
a{ font-size:12px; color:#214263; text-decoration:none; }
a:hover{ font-size:12px; color:#ffffff; background-color:#ff9900; text-decoration:none;display:block;} 
</style>
<script src="../include/js/chkFrm.js"></script>
   <%
	 Ac obj = new Ac(globa);
	 ArrayList<String> listCities = obj.listAllCitys(""); 
	 if(listCities != null)
	 {
	%>

	<script language="javascript"> 

					  var data={};
					  data["-1_jiangsu"] = "text:安徽省;url:javascript:void(0);target:mainFrame;";
								<%
			 						for(int k=0;k<listCities.size();k++)
			 						{
										String cityName = listCities.get(k);
										ArrayList<String> listCountries = obj.listCountriesOfCity(" where strCity='"+cityName+"'");
										%>
										 	 data['<%="jiangsu_"+cityName+"cityName"%>'] = "text:"+'<%=cityName%>'+";target:mainFrame;";
										<%
										if(listCountries != null )
										{
											for(int m=0;m<listCountries.size();m++)
											{
												String countryName = listCountries.get(m);
												ArrayList<String> listClassOneAcs = obj.listClassOneAcs(" where strCity='"+cityName+"' and strTown='"+countryName+"'");
										%>
										 		 data['<%=cityName+"cityName_"+countryName+"countyName"%>'] = "text:"+'<%=countryName%>'+";target:mainFrame;";
										<%
										if(listClassOneAcs !=null)
										{
												for(int m1 = 0 ;m1<listClassOneAcs.size();m1++)
												{
													String oneAcName = listClassOneAcs.get(m1);
													
												 	String tempString ="namestart"+oneAcName+"nameendimport";
												 	
													
										%>
											 		 data['<%=countryName+"countyName_"+tempString%>'] = "text:"+'<%=oneAcName%>'+";target:mainFrame;";
										<%	
												}
											}
										  }
										}		 						
			 						}
			 			%>
			 					  
									
</script>
	<%
	 }
	%>
	<%
	 %>
<script language="javascript">
var i1 = 1;
var count = 1;
    function chkFrm() {
   // for(var d=0;d<5;d++)alert(d);
   
       if(trim(frm.strClassOneHP.value)=="") {
            alert("请选择一级热点！！！")
            frm.strClassOneHP.focus();
            return false;
        }
        if(trim(frm.strHotSpot.value)=="") {
            alert("请选择二级热点！！！")
            frm.strHotSpot.focus();
            return false;
        }
        if(frm.strMac_Addr.value==""){
        	alert("MAC地址不可为空！！！")
            frm.strMac_Addr.focus();
            return false;
        }
       	
       	frm.submit();

    }
   function getAcName1()
 {
 
    var classoneac1 = document.getElementById("strClassOneHP").value ;
   	$("#strHotSpot").html("");
	$("#strHotSpot").append("<option value=''>- - - - -请选择- - - - -</option>");
 
 	<%
 		
 		for (int j = 0; j <  classOneList.size(); j++) {
			String hotspotone = (String)(classOneList.get(j)[0]);//
			
			ArrayList<Ac> classtwoac = (ArrayList<Ac>)(classOneList.get(j)[1]);
			%>
			
			if(classoneac1 != null && classoneac1!="" && classoneac1 == '<%=hotspotone%>')
			{
			<%
			  for(int i=0;i<classtwoac.size();i++){
			  Ac acObj = classtwoac.get(i);
			%> 
				$("#strHotSpot").append("<option value='<%=acObj.getStrId()%>'><%=acObj.getStrHotPotName()%></option>");
				
			<%
			  }
			%>
			} 
			<%
		}
 		%>
 }
  

    
</script>
<script>
var isIe=(document.all)?true:false;
//设置select的可见状态
var j=1;
function setSelectState(state)
{
var objl=document.getElementsByTagName('select');
for(var i=0;i<objl.length;i++)
{
//alert();
objl[i].style.visibility=state;
}
}

//弹出方法
function showMessageBox(e,wWidth,wHeight)
{ 

	closeWindow();
	var bWidth=parseInt(document.documentElement.scrollWidth);
	var bHeight=parseInt(document.documentElement.scrollHeight);
	if(isIe){ 
		setSelectState('hidden');
	}
	var back=document.createElement("div");
	back.id="back";
	var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
	styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
	back.style.cssText=styleStr;
	document.body.appendChild(back);
	showBgSuddenlly(back,50);//背景突然变暗
	//showBgGradually(back,50);//背景逐渐变暗
	var mesW=document.createElement("div");
	//---------------------

	//---------------------
	mesW.id="mesWindow";
	mesW.className="mesWindow";  
    Using("System.Web.UI.WebControls.MzTreeView");
    var a = new MzTreeView("");
    a.dataSource = data ;
    a.autoSort=true;
    a.useCheckbox=true
    a.canOperate=true;  // alert(a.render())
   // alert(a.render());
    var tempString="";
	  var tempString="";
	 tempString =  tempString+ "<div id='contentDiv' class='mesWindowTop'><table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='8FA6BD' >"+
                                    "<tr>  <td class='layertit'><table width='100%' height='32' border='0' cellpadding='0' cellspacing='0'><tr>";
	tempString  = tempString+ "<td class='tit'><strong><font style='font-size:14px' color='#FFFFFF'>热点选择  </font></strong></td>" + 
						                             	"<td swidth='28%' align='right' class='layri'onclick='closeWindow();'style='cursor:hand'><img src='../images/layer_gb.jpg'  title='关闭窗口'  /><font  color='#FFFFFF'>关闭</font></td>";
	tempString = tempString + "</tr></table></td></tr><tr> <td background='../images/layer_bg.jpg' class='listd'><table id='resultTable' width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>"+
						            "<tr> <td> "+a.render()+"</td></tr>" + 
						            "<tr><td><img src='../images/layer_bot.png' width='400' height='6' /></td></tr></table></td></tr></table></td></tr> </table> </div>";
				          
	mesW.innerHTML=tempString; 
	   var   t=e.offsetTop; 
	   var   l=e.offsetLeft; 
	  //  alert(e.offsetTop);
	   while(e=e.offsetParent){ 
	        t+=e.offsetTop; 
	        l+=e.offsetLeft; 
	        } 
	var leftPoint = l;
	var topPoint = t;
	
	styleStr="left:"+leftPoint+"px;top:"+topPoint+"px;position:absolute;width:"+wWidth+"px;";
	mesW.style.cssText=styleStr;
	document.body.appendChild(mesW); 
    a.expandLevel(2);//梅花树展开
	
}
//让背景渐渐变暗
function showBgGradually(obj,endInt)
{
if(isIe)
{
	obj.filters.alpha.opacity+=1;
	if(obj.filters.alpha.opacity<endInt)
	{
		setTimeout(function(){showBgGradually(obj,endInt)},5);
	}
}else{
	var al=parseFloat(obj.style.opacity);
	al+=0.01;
	obj.style.opacity=al;
	if(al<(endInt/100))
	{
		setTimeout(function(){showBgGradually(obj,endInt)},5);}
	}
}

//让背景突然变暗
function showBgSuddenlly(obj,endInt)
{
	if(isIe)
	{
		obj.filters.alpha.opacity += endInt;//背景突然变暗
	}else{
		var al=parseFloat(obj.style.opacity);
		al+=0.01*endInt;
	 	obj.style.opacity=al;//背景突然变暗
		 
	}
}
//关闭窗口
function closeWindow()
{


if(document.getElementById('back')!=null)
{
document.getElementById('back').innerHTML="";
document.getElementById('back').parentNode.removeChild(document.getElementById('back'));


}
if(document.getElementById('mesWindow')!=null)
{
document.getElementById('mesWindow').innerHTML="";
document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));

}

if(isIe){
	 setSelectState('');
	}
	
}

//弹出窗口
function testMessageBox(e)
{

	//var objPos = mousePosition(ev); 
	//showMessageBox(objPos,400,200);
	showMessageBox(e,400,200);

}

                  
</script>
</head>

<body>

<form name="frm" method=post action="ap_act.jsp" >

<input type="hidden" name="<%=Constants.ACTION_TYPE%>" value="<%=Constants.UPDATE_STR%>"/>
<input type="hidden" name=device_Id value="<%=obj0.getDevice_Id()%>">
<input type="hidden" name="papernum" value=""/>
<div class="lf_list">
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="bottom" />&nbsp;<font size="2px">您现在所在的位置：</font><font color="#0e7cc9" size="2px">资源管理 </font><font size="2px">&gt;AP信息管理</font></td>
  </tr>
</table>
<table id="tb" width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr> <td class="listtit1"align="left">&nbsp; &nbsp;<font size="2px"> AP修改</font></td>
</tr>
 
  <tr>
    <td bgcolor="#FFFFFF" class="listd" style="border-left:1px solid #dddddd;border-right:1px solid #dddddd;">&nbsp;
   
    <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">        
     <tr>
       <td >
       <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:10px 0px 2px 0px;">
       <tr>
	     <td width="4%" align="left" >
	     </td>

		</tr>
       </table></td></tr>

          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="10%" height="30" align="right" class="left_txt2"><font size="2px">一级热点：</font></td>
                
                <td width="32%" height="30">
                <input id="strClassOneHP" name="strClassOneHP" value="<%=obj0.getStrClassOneHP() %>" type="text" class="input_box" value="" size="30" onfocus="testMessageBox(this)" /></td>
      
                <td height="30" class="left_txt">&nbsp;</td>
              </tr>
             <tr>

            <td width="35%" height="30" align="right" class="left_txt2" ><font size="2px">二级热点：</font></td>
             
            <td width="40%" height="30">
            <select id="strHotSpot" name="strHotSpot"  style="width:215px"   class="sel1" onfocus="getAcName1()" ><option value=''>- - - - -请选择- - - - -</option>
                   <%  
                   	for(int i=0; i<strACTwo.size(); i++){
                  	 if(obj0.getStrHotSpotName().equals(strACTwo.get(i))){
                  	 	String selected="selected='selected'";
				%>
				<option value="<%=obj0.getStrHotSpotName()%>" <%=selected%>><%=obj0.getStrHotSpotName()%></option>
				<%
				 	}
				 	else{
				 %>
				 <option value="<%=classTwoAc%>"><%=classTwoAc%></option>
				<%
				 	}
				 	}
				%>             
         </select></td>
         </tr>
         
         <tr>
        <td align="right" class="tdwz">MAC地址：</td>
        <%  String name="";
               if(obj0.getStrMac_Addr()!=null)name=obj0.getStrMac_Addr();%>
       <td ><input type="text"  class="ipt" name="strMac_Addr"  readonly="readonly"   value="<%=name%>"/>&nbsp;<font size="2" color="#FF0000">MAC地址不可修改</font></td>
      </tr>
      
        <tr>
        <td align="right" class="tdwz">设备名：</td>
        <td><input name="device_Name" type="text"  value="<%=Format.forbidNull(obj0.getDevice_Name())%>"  class="ipt"/></td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">设备别名：</td>
        <td><input name="device_Alias" type="text"  value="<%=Format.forbidNull(obj0.getDevice_Alias())%>" class="ipt"/></td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">AC名：</td>
        <td><input name="strAc_Name" type="text"  value="<%=Format.forbidNull(obj0.getStrAc_Name())%>" class="ipt"/></td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">转化器名称：</td>
        <td><input name="strSwitch_Name" type="text" value="<%=Format.forbidNull(obj0.getStrSwitch_Name())%>"  class="ipt"/></td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">光纤名：</td>
        <td><input name="strOnu_Name" type="text" value="<%=Format.forbidNull(obj0.getStrOnu_Name())%>"  class="ipt"/></td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">覆盖区域：</td>
        <td><select name="strVocerage_Area" class="input_box">
        <option value=''>- - - - -请选择- - - - -     </option>
                 <%
                  //从全局变量中读取用户类型
                  String coverType = (String)application.getAttribute("COVER_TYPE");
                  coverType = coverType !=null ? coverType:"";
                  String tempString = obj0.getStrVocerage_Area()==null?"":obj0.getStrVocerage_Area();
                  String  strVocerage_Area=ParamUtil.getString(globa.request,"strVocerage_Area",tempString);
                  String[] coverTypes = coverType.split(",");
                  for (int i = 0; i < coverTypes.length; i++) {
              %>
                <option value="<%=coverTypes[i]%>" <%if(strVocerage_Area!=null && strVocerage_Area.equals(coverTypes[i])) out.print("selected");%>><%=coverTypes[i]%></option>
              <%
                  }
              %> 
                 </select></td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">覆盖类型：</td>
        <td><select name="strCoverage_Type" class="input_box">
        <option value=''>- - - - -请选择- - - - -     </option>
                 <%
                  //从全局变量中读取用户类型
                  String coverType1 = (String)application.getAttribute("COVER_TYPE");
                  coverType1 = coverType1 !=null ? coverType1:"";
                  String tempString1 = obj0.getStrCoverage_Type()==null?"":obj0.getStrCoverage_Type();
                  String  strCoverage_Type=ParamUtil.getString(globa.request,"strCoverage_Type",tempString);
                  String[] coverTypes1 = coverType1.split(",");
                  for (int i = 0; i < coverTypes1.length; i++) {
              %>
                <option value="<%=coverTypes1[i]%>" <%if(strCoverage_Type!=null && strCoverage_Type.equals(coverTypes1[i])) out.print("selected");%>><%=coverTypes1[i]%></option>
              <%
                  }
              %> 
                 </select></td>
        <td>&nbsp;</td>
      	</tr>
        
        <tr>
        <td align="right" class="tdwz">IP地址：</td>
        <td><input name="strIp_Addr" type="text" value="<%=Format.forbidNull(obj0.getStrIp_Addr())%>"  class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">IP网关：</td>
        <td><input name="strIp_Mask" type="text" value="<%=Format.forbidNull(obj0.getStrIp_Mask())%>"  class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">SSID：</td>
        <td><input name="strSsId" type="text" value="<%=Format.forbidNull(obj0.getStrSsId())%>"   class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">标准：</td>
        <td><input name="strInter_Standard" type="text" value="<%=Format.forbidNull(obj0.getStrInter_Standard())%>"   class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">设备种类：</td>
        <td><input name="strDevice_Type" type="text"  value="<%=Format.forbidNull(obj0.getStrDevice_Type())%>" class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">设备位置：</td>
        <td><input name="strDevice_Position" type="text" value="<%=Format.forbidNull(obj0.getStrDevice_Position())%>"  class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">识别名：</td>
        <td><input name="isEquence_Number" type="text" value="<%=Format.forbidNull(obj0.getIsEquence_Number())%>" class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">设备模型：</td>
        <td><input name="device_Model" type="text" value="<%=Format.forbidNull(obj0.getDevice_Model())%>"   class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">设备供应商：</td>
        <td><input name="device_Vendor" type="text"  value="<%=Format.forbidNull(obj0.getDevice_Vendor())%>"  class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>
      	
      	<tr>
        <td align="right" class="tdwz">操作人：</td>
        <td><input name="strCreator" type="text"  value="<%=Format.forbidNull(obj0.getStrCreator())%>"  class="ipt"/>
        </td>
        <td>&nbsp;</td>
      	</tr>

        <tr>
        <td>&nbsp;</td>
        <td height="50" colspan="2" align="left"><input name="B1" type="button"   value="确  定" onclick="chkFrm()"  class="ipt1" style="cursor:hand"/>
          &nbsp;<input  name="B12" type="reset"  value="取 消" class="ipt2" style="cursor:hand"/>
          &nbsp;<input name="B12" type="button"  onclick="window.location.href='ap_list.jsp';" value="返 回" class="ipt2" style="cursor:hand"/></td>
      
        </tr>
      </table>
      
            </td>
          </tr>
        </table>
  
</td>
  </tr>
 
</table>
 </div>
<p><br />
</p>
    </form>
 	<table id="testTable" width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr> <td>
	<script language="javascript">
	  // document.write(a.render());
	 //  a.expandLevel(1);
	</script>
	</td></tr></table>
</body>
</html>
<%}catch(Exception e){e.printStackTrace();} %>
